const PREFIX = 'qa_'
const QaActionType = {
  set_list_width: PREFIX + 'set_list_width',
  set_select_links: PREFIX + 'set_select_links',
  init_link_list: PREFIX + 'init_link_list',
  toggle_link_loading: PREFIX + 'toggle_link_loading',
  toggle_show_link: PREFIX + 'toggle_show_link',
  set_search_value: PREFIX + 'set_search_value',
  toggle_big_image: PREFIX + 'toggle_big_image',
  update_voice_status: PREFIX + 'update_voice_status',
  update_new_msg_count: PREFIX + 'update_new_msg_count'
}

const setWidth = (width) => {
  return {
    type: QaActionType.set_list_width,
    width: width
  }
}
const setSearchValue = (value) => {
  return {
    type: QaActionType.set_search_value,
    value: value
  }
}
const setSelectLinks = (links) => {
  return {
    type: QaActionType.set_select_links,
    links: links
  }
}

const initLinkList = (list) => {
  return {
    type: QaActionType.init_link_list,
    list: list
  }
}

const toggleLinkLoading = (bool) => {
  return {
    type: QaActionType.toggle_link_loading,
    loading: bool
  }
}

const toggleShowLink = (bool) => {
  return {
    type: QaActionType.toggle_show_link,
    show: bool
  }
}
const toggleBigImage = (url) => {
  return {
    type: QaActionType.toggle_big_image,
    url: url
  }
}
const updateVoiceStatus = (status) => {
  return {
    type: QaActionType.update_voice_status,
    status: status
  }
}

const updateNewMsgCount = (setZero) => {
  return {
    type: QaActionType.update_new_msg_count,
    setZero: setZero
  }
}

module.exports = {
  QaActionType,
  setWidth,
  setSelectLinks,
  initLinkList,
  toggleLinkLoading,
  toggleShowLink,
  setSearchValue,
  toggleBigImage,
  updateVoiceStatus,
  updateNewMsgCount
}
